package j04yichang2;

import java.util.Random;

class Cat{
    int age=9;
}

public class J1 {
    public static void main(String[] args) {
        Random r = new Random();
        try {
            if(r.nextInt(10)<5){
                System.out.println(10/0);
            }else {
                Cat c1 = null;
                System.out.println(c1.age);
            }
        }catch (ArithmeticException e){
//            e.printStackTrace();
            System.out.println("数学异常");
        }catch (NullPointerException e){
//            e.printStackTrace();
            System.out.println("空指针异常");
        }catch (Exception e){
//            e.printStackTrace();
            System.out.println("异常");
        }finally {
            System.out.println("finally");
        }

    }
}
